//
//  GRSlider.m
//  SleepingElf
//
//  Created by karong on 2023/10/19.
//

#import "GRSlider.h"

@implementation GRSlider

- (CGRect)trackRectForBounds:(CGRect)bounds {
    bounds = [super trackRectForBounds:bounds]; // 必须通过调用父类的trackRectForBounds 获取一个 bounds 值，否则 Autolayout 会失效，UISlider 的位置会跑偏。
    return CGRectMake(bounds.origin.x, bounds.origin.y, bounds.size.width, 8); // 这里面的h即为你想要设置的高度。
}

- (CGRect)thumbRectForBounds:(CGRect)bounds trackRect:(CGRect)rect value:(float)value {
    rect.origin.x = rect.origin.x - 20 ;
    rect.size.width = rect.size.width + 40;
    return CGRectInset ([super thumbRectForBounds:bounds trackRect:rect value:value], 20 , 20);
}
@end
